

public class Timer extends Thread{
	
	public static final long DEFAULT_SLEEP_TIME = 5000;
	private Router router;
	private long sleepTime;

	public Timer( Router router ){
		this.router = router;
		this.sleepTime = DEFAULT_SLEEP_TIME;
	}
	
	public Timer( Router router, long sleepTime ){
		this.router = router;
		this.sleepTime = sleepTime;
	}
	

	public void run() {

		try{
			while( router.isPowerOn() ){
				this.router.timeEventOccurred();
				Thread.sleep( this.sleepTime );
			}
			
		}catch (Exception e) {
			e.printStackTrace();
		}
	}

}
